<?php

namespace app\api\controller\v1;

use app\common\controller\BaseController;
use app\common\model\PostClass as PostClassModel;
use app\common\validate\TopicValidate;

class PostClass extends BaseController
{

    public function index()
    {
        // 获取文章分类
        $list = (new PostClassModel())->getPostClassList();

        return $this->showResCode('获取成功', ['list' => $list], 200);
    }

    // 获取指定文章分类下的文章
    public function post()
    {
        (new TopicValidate())->goCheck('getpostlist');
        $list = (new PostClassModel())->getPost();
        return $this->showResCode('获取成功', ['list' => $list], 200);
    }
}
